Skip to content

feat: add config types, validation, and docs for Slack message strategies#5226

Draft
santiagofn wants to merge 4 commits into
prometheus:mainfrom
santiagofn:feat/slack-thread-config-and-docs
Draft

feat: add config types, validation, and docs for Slack message strategies#5226
santiagofn wants to merge 4 commits into
prometheus:mainfrom
santiagofn:feat/slack-thread-config-and-docs

Conversation

@santiagofn
Copy link
Copy Markdown

@santiagofn santiagofn commented May 6, 2026

Part 3 of a series implementing threaded message support for the Slack notifier. Full picture: #5150. Depends on #5224 and #5225.

Summary

Adds configuration types, validation logic, and documentation for two new Slack message strategies: update and thread. Includes 7 new test configuration fixtures covering valid configs and expected error cases.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b5052ac5-5b93-4a37-9085-24dfac96e982

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Moves the Slack notifier's internal types (`Notifier`, `request`,
`attachment`, `slackResponse`) from slack.go into a new types.go.
No behavioral changes.

While moving them, two doc comments were tightened:
- `request`: "slack notification" -> "Slack notification"
- `attachment`: "richly-formatted message block" -> "richly formatted
  message block"

Signed-off-by: Santiago Fernández Núñez <[email protected]>
Co-authored-by: Cursor <[email protected]>
@santiagofn santiagofn force-pushed the feat/slack-thread-config-and-docs branch from a91e7db to d76b1f5 Compare May 14, 2026 15:59
Moves SlackConfig (and the related SlackAction, SlackConfirmationField,
SlackField types plus DefaultSlackConfig) from config/notifiers.go into
a new notify/slack/config.go, following the same pattern used recently
for the mattermost, jira, and incidentio notifiers.

The Slack-specific unmarshal tests are moved alongside them into
notify/slack/config_test.go. config.Receiver now refers to
*slack.SlackConfig, and notify/slack no longer needs to import the
top-level config package.

No behavioral changes.

Signed-off-by: Santiago Fernández Núñez <[email protected]>
Co-authored-by: Cursor <[email protected]>
@santiagofn santiagofn force-pushed the feat/slack-thread-config-and-docs branch from d76b1f5 to 0955986 Compare May 14, 2026 17:43
santiagofn and others added 2 commits May 14, 2026 15:26
Previously the Slack notifier hardcoded the chat.update endpoint to
"https://slack.com/api/chat.update" regardless of the configured
api_url. Deployments pointing api_url at a Slack-compatible proxy or
forwarder were therefore forced back onto slack.com for update calls,
which is the wrong host for proxy users.

Move the URL handling into a new internal/apiurl package, and route
chat.update (and any future Slack Web API method) through the same
api_url / api_url_file base as the initial chat.postMessage call.
Standard configurations are unaffected; the generated URL is byte
identical.

The Resolver also reads api_url_file on every call, matching previous
behaviour so that file rotations apply to the next notification without
restarting Alertmanager.

Signed-off-by: Santiago Fernández Núñez <[email protected]>
Co-authored-by: Cursor <[email protected]>
@santiagofn santiagofn force-pushed the feat/slack-thread-config-and-docs branch from 0955986 to 46a265d Compare May 14, 2026 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant